package com.zat.mes.andrmes.customerview.adapter

import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.zat.mes.andrmes.R

/**
 * 通用底部弹框 但须
 */
class BottomDialogSignCommAdapter(layoutResId: Int) : BaseQuickAdapter<String, BaseViewHolder>(
    layoutResId
) {
    var selectPosition: Int = -1


    override fun convert(helper: BaseViewHolder, item: String) {
        helper.setText(R.id.tvNameItemDialog, item)
        val ivSelect = helper.getView<ImageView>(R.id.ivSelectItemDialog)
        if (selectPosition == helper.layoutPosition) {
            //选中
            ivSelect.setImageResource(R.mipmap.ico_selected)
        } else {
            ivSelect.setImageResource(R.color.color_transparent)
        }
        helper.itemView.setOnClickListener {
            selectPosition = helper.layoutPosition
            notifyDataSetChanged()
        }

    }
}